package com.cloud.drore.eboss.supplier.controller;

import com.cloud.drore.eboos.common.base.PagePo;
import com.cloud.drore.eboos.common.base.ResultMessage;
import com.cloud.drore.eboss.login.user.Anon;
import com.cloud.drore.eboss.operation.entity.po.DistributorInfoPo;
import com.cloud.drore.eboss.operation.entity.po.DistributorsAllRelationPo;
import com.cloud.drore.eboss.operation.entity.vo.DistributorInfoVo;
import com.cloud.drore.eboss.supplier.entity.po.SupplierAndDistributorRelationPo;
import com.cloud.drore.eboss.supplier.operationApiService.ISupplierAndDistributorRelationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 浙江卓锐科技股份有限公司 版权所有  Copyright 2018<br>
 *
 * @Description: <br>
 * @Project: eboos <br>
 * @CreateDate: Created in 2018/3/23 10:11 <br>
 * @Author: <a href="1451173193@qq.com">杨亮</a>
 */
@RestController
@RequestMapping("/suppliersRelation")
@Api(value = "/供应商-分销商关联接口", description = "供应商-分销商关联接口-杨亮")
public class SupplierAndDistributorRelationController {
    @Resource
    ISupplierAndDistributorRelationService supplierAndDistributorRelationService;

    @ApiOperation(value = "根据供应商id查询分销商列表")
    @GetMapping("/getDistributorList")
    @Anon
    ResultMessage<List<SupplierAndDistributorRelationPo>> getAllDistributorBySupplierId(Long supplierId) {

       return  supplierAndDistributorRelationService.getAllDistributorBySupplierId(supplierId);
    }

    @ApiOperation(value = "查询供应商关联的分销商列表信息(供应商合作管理)")
    @PostMapping("/getDistributorInfoList")
    ResultMessage<List<DistributorInfoVo>> getDistributorInfoListBySupplier(@RequestBody PagePo<DistributorInfoPo> pagePo) {

        return  supplierAndDistributorRelationService.getDistributorInfoListBySupplier(pagePo);
    }
    @ApiOperation(value = "根据分销商id,产品名称获取与当前供应商合作的已上架的产品列表")
    @PostMapping("/getDistributorsAllRelation")
    public ResultMessage getDistributorsAllRelation(@RequestBody PagePo<DistributorsAllRelationPo> pagePo){

        return supplierAndDistributorRelationService.getDistributorsAllRelation(pagePo);
    }
}